import request from '../untils/request'

//按id查找用户
export function getById(id){
    return request.get(`/users/${id}`)
}
//查找所有用户
export const getUserList = (params) => {
    return request.get('/users',{params:params})
}
//删除用户
export const deleteUserById = (id) => {

    return request.delete(`/users/${id}`)
}


// export const putUserById = (params) => {

//     return request.put('/users/',{params:params})
// }
//修改用户
export function putUserById(id,data) {
    return request({
      url: `/users/${id}`,
      method: 'put',
      data
    })
  }

// export const addUser = ()=>{

//     return request.post(`/users`)
// }
//添加用户
export function addUser(data) {
    return request({
      url:'/users',
      method: 'post',
      data
    })
  }


//用户登入

  export function login(data) {
    return request({
      url:'/users/token',
      method: 'post',
      data
    })
  }